<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>测试worker 的多线程</title>
</head>

<body>
  <script>
    // 主线程
    const worker = new Worker('worker.js')
    worker.onmessage = e => {
      console.log(e.data)
    }

  </script>
</body>

</html>